import axios from 'axios'
import spinner from './spinner'

//http 
axios.defaults.withCredentials = true;
// http request 拦截器
axios.interceptors.request.use(
  config => {
    /* 代码写这里 */
    spinner.show(config)
    return config;
  },
  err => {
    spinner.hide(response)
    return Promise.reject(err);
  });
 
// http response 拦截器
axios.interceptors.response.use(
  response => {
    /* 代码写这里 */
    spinner.hide(response)
    return response;
  },
  err => {
    console.log(err)
    return Promise.reject(err);
  });
export default axios;
